import {
  HTTP
} from 'utils/http';
import config from 'utils/config';

class IndexModel extends HTTP {
  /**
   * 请求首页数据
   * @param {*} cityId 城市id
   * @return 返回一个Promise对象resolve抛出响应的数据
   */
  getHomeDatas(cityId) {
    return new Promise((resolve, reject) => {
      this.axiosPost({
        url: config.API.GET_HOME_DATAS,
        DATA: {
          cityId
        },
        success: function (data) {
          resolve({
            data,
            status: 0
          });
        },
        error: function (err) {
          resolve({
            err,
            status: -1
          });
        }
      })
    })
  }
}

export {
  IndexModel
};
